//
//  AccelerometerDelegate.m
//  AutoPong
//
//  Created by Thomas Dupont on 10/12/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "AccelerometerDelegate.h"

#define kFilteringFactor 0.1

@implementation AccelerometerDelegate

@synthesize x, y, z;

- (id)init
{
	if (self = [super init]) {
		x = 0;
		y = 0;
		z = 0;
	}
	return self;
}

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
	/*
	x = [acceleration x] - ( ([acceleration x] * kFilteringFactor) + (x * (1.0 - kFilteringFactor)) );
	y = [acceleration y] - ( ([acceleration y] * kFilteringFactor) + (y * (1.0 - kFilteringFactor)) );
	z = [acceleration z] - ( ([acceleration z] * kFilteringFactor) + (z * (1.0 - kFilteringFactor)) );
	*/
	x = [acceleration x];
	y = [acceleration y];
	z = [acceleration z];
}


@end
